package qianfeng.com.meijiadaka.viewholder;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;

import cn.lemon.view.adapter.BaseViewHolder;
import qianfeng.com.meijiadaka.R;
import qianfeng.com.meijiadaka.bean.Home_info1;

/**
 * Created by linlongxin on 2016/8/23.
 */

public class TextImageViewHolder extends BaseViewHolder<Home_info1.ResultBean.ChannelBean> {

    private ImageView iv;
    private TextView tv1,tv2;

    public TextImageViewHolder(ViewGroup parent) {
        super(parent, R.layout.home_image);
    }

    @Override
    public void onInitializeView() {
        super.onInitializeView();
        iv=(ImageView)findViewById(R.id.home_adapter_iv);
        tv1=(TextView)findViewById(R.id.home_adapter_tv1);
        tv2=(TextView)findViewById(R.id.home_adapter_tv2);
    }

    @Override
    public void setData(Home_info1.ResultBean.ChannelBean object) {
        super.setData(object);
        tv1.setText(object.getChannelTitle());
        tv2.setText(object.getLiveBeginTime());
        Glide.with(itemView.getContext()).load(object.getChannelPicture()).into(iv);
    }

    @Override
    public void onItemViewClick(Home_info1.ResultBean.ChannelBean object) {
        super.onItemViewClick(object);
        Toast.makeText(itemView.getContext(),"点击了图片",Toast.LENGTH_SHORT).show();
    }
}
